import request from './http'

/**
 * @param {string} method
 * 1.查询工单GET,
 * 2.新建工单POST,
 * 3.编辑工单PUT,
 * 4.品牌责任人变更PUT,
 * 5.品牌部交付PUT,
 * 6.品牌部计算工单难度PUT,
 * 7.运营确认上传作品PUT
 * 8.启停PUT
 * @param {*} data
 */
export const getRetouchOrder = (data, method, headers={}) => {
  if (method === 'get') {
    const { store_id, operator_id, order_name, status, page, size, brand_worker_id, start_date, end_date, brand_worker_delivery_time_start, brand_worker_delivery_time_end } = data
    const url = `store_id=${store_id}&operator_id=${operator_id}&order_name=${order_name}&status=${status}&page=${page}&size=${size}&brand_worker_id=${brand_worker_id}&start_date=${start_date}&end_date=${end_date}&brand_worker_delivery_time_start=${brand_worker_delivery_time_start}&brand_worker_delivery_time_end=${brand_worker_delivery_time_end}`
    return request({ method, url: `/api/v1/retouch_order?${url}` })
  } else {
    return request({ method, url: '/api/v1/retouch_order', data, headers })
  }
}
// 店铺信息
export const getStoreData = () => {
  return request({ method: 'get', url: '/api/v1/store_data' })
}
// 人员信息
export const getUserList = (depart_id) => {
  return request({ method: 'get', url: `/api/v1/user_list?depart_id=${depart_id}` })
}
// 获取工单难度详情
export const getOrderDifficultyDetail = () => {
  return request({ method: 'get', url: '/api/v1/order_difficulty_detail'})
}
// 下载运营上传附件
export const downloadOrderFile = (orderId) => {
  return request({ method: 'get', url: `/api/v1/download_order_file?order_id=${orderId}`, responseType: 'blob', headers: {} })
}
// 下载品牌部交付附件
export const downloadBrandWork = (orderId) => {
  return request({ method: 'get', url: `/api/v1/download_brand_work?order_id=${orderId}`, responseType: 'blob', headers: {} })
}
// 工单效率一览表
export const getOrderEfficiencylist = (params) => {
  const { brand_worker_id, start_date, end_date, page, size, efficiency_low, efficiency_high, brand_worker_delivery_time_start, brand_worker_delivery_time_end } = params
  return request({ method: 'get', url: `/api/v1/order_efficiency_list?brand_worker_id=${brand_worker_id}&start_date=${start_date}&end_date=${end_date}&page=${page}&size=${size}&efficiency_low=${efficiency_low}&efficiency_high=${efficiency_high}&brand_worker_delivery_time_start=${brand_worker_delivery_time_start}&brand_worker_delivery_time_end=${brand_worker_delivery_time_end}` })
}
// 采购工单查询
export const getPurchaseOrderlist = (params) => {
  const { code, status, start_date, end_date, page, size, spu } = params
  return request({ method: 'get', url: `/api/v1/purchase_order_list?code=${code}&status=${status}&start_date=${start_date}&end_date=${end_date}&page=${page}&size=${size}&spu=${spu}` })
}
// 采购工单详情
export const getPurchaseOrderDetail = (order_id) => {
  return request({ method: 'get', url: `/api/v1/purchase_order_detail?order_id=${order_id}` })
}
// 下载采购工单附件
export const downloadPurchase = (orderId) => {
  return request({ method: 'get', url: `/api/v1/download_purchase_attachment?order_id=${orderId}`, responseType: 'blob', headers: {} })
}
// 查看PMC计划跟踪总表
export const getPmcPlan = ({
  code,
  spu,
  status,
  start_date,
  end_date,
  page,
  size,
  identification_code,
  order_month,
  shop,
  garment_color_description,
  fabric_category,
  supplier,
  disposal_processing_plant,
  responsible_pc,
  physical_control_order_status_warning,
  purchase_order_date,
  purchase_order_time,
  purchase_order_duration,
  purchase_order_status_warning,
  fabric_cycle_duration,
  fabric_cycle_warning,
  expected_return_date_auxiliary_material_procurement,
  excipient_cycle_duration,
  excipient_cycle_warning,
  material_cycle_warning,
  fabric_abnormal_progress_report,
  shrink_cycle_warning,
  cutting_bed_cycle_warning,
  dispensing_type,
  delivery_early_warning,
  production_abnormality_report,
  delivery_period_status,
  node_exception_summary,
  description_physical_control_node_abnormality,
  purchase_node_exception_description,
  shrink_exception_node_description,
  description_abnormal_node_cutting_machine,
  description_abnormality_material_issuing_node,
  production_exception_description
}) => {
  const p1 = `?page=${page}&size=${size}&code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}`
  const p2 = `&identification_code=${identification_code}&order_month=${order_month}&shop=${shop}&garment_color_description=${garment_color_description}`
  const p3 = `&fabric_category=${fabric_category}&supplier=${supplier}&disposal_processing_plant=${disposal_processing_plant}&responsible_pc=${responsible_pc}`
  const p4 = `&physical_control_order_status_warning=${physical_control_order_status_warning}&purchase_order_date=${purchase_order_date}&purchase_order_time=${purchase_order_time}`
  const p5 = `&purchase_order_duration=${purchase_order_duration}&purchase_order_status_warning=${purchase_order_status_warning}&fabric_cycle_duration=${fabric_cycle_duration}`
  const p6 = `&fabric_cycle_warning=${fabric_cycle_warning}&expected_return_date_auxiliary_material_procurement=${expected_return_date_auxiliary_material_procurement}&excipient_cycle_duration=${excipient_cycle_duration}`
  const p7 = `&excipient_cycle_warning=${excipient_cycle_warning}&material_cycle_warning=${material_cycle_warning}&fabric_abnormal_progress_report=${fabric_abnormal_progress_report}`
  const p8 = `&shrink_cycle_warning=${shrink_cycle_warning}&cutting_bed_cycle_warning=${cutting_bed_cycle_warning}&dispensing_type=${dispensing_type}`
  const p9 = `&delivery_early_warning=${delivery_early_warning}&production_abnormality_report=${production_abnormality_report}&delivery_period_status=${delivery_period_status}`
  const p10 = `&node_exception_summary=${node_exception_summary}&description_physical_control_node_abnormality=${description_physical_control_node_abnormality}&purchase_node_exception_description=${purchase_node_exception_description}`
  const p11 = `&shrink_exception_node_description=${shrink_exception_node_description}&description_abnormal_node_cutting_machine=${description_abnormal_node_cutting_machine}`
  const p12 = `&description_abnormality_material_issuing_node=${description_abnormality_material_issuing_node}&production_exception_description=${production_exception_description}`
  const params = `${p1}${p2}${p3}${p4}${p5}${p6}${p7}${p8}${p9}${p10}${p11}${p12}`.split('undefined').join('')
  return request({ method: 'get', url: `/api/v1/pmc_plan_track_total${params}` })
}
// 编辑PMC计划跟踪总表
export const updatePmcPlan = (data) => {
  return request({ method: 'put', url: `/api/v1/pmc_plan_track_total`, data })
}
// 下载PMC计划跟踪总表
export const downloadPmcPlan = ({
  code,
  spu,
  status,
  start_date,
  end_date
}) => {
  return request({ method: 'get', url: `/api/v1/pmc_plan_track_download?code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}`, responseType: 'blob', headers: {} })
}
// 查看采购总表
export const getMaterial = ({
  code,
  spu,
  status,
  start_date,
  end_date,
  page,
  size,
  store_name_model_color,
  store_order_stats_id,
  order_month,
  shop,
  purchase_order_data_identifier,
  garment_color_description,
  classification_surface_accessories,
  supplier,
  material_color_classification,
  supplier_material_name_1,
  material_color_description_1,
  supplier_material_name_2,
  material_color_description_2,
  categories_materials,
  actual_total_purchased_kg_quantity,
  notes_on_physical_control_plan,
  abnormal_progress_report,
  exceeded_planned_delivery_date_exception_description,
  follow_up_major_quality_abnormalities,
  material_classification_identification_code_1,
  material_classification_identification_code_2
}) => {
  const p1 = `?page=${page}&size=${size}&code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}&store_name_model_color=${store_name_model_color}`
  const p2 = `&store_order_stats_id=${store_order_stats_id}&order_month=${order_month}&shop=${shop}&purchase_order_data_identifier=${purchase_order_data_identifier}`
  const p3 = `&garment_color_description=${garment_color_description}&classification_surface_accessories=${classification_surface_accessories}`
  const p4 = `&supplier=${supplier}&material_color_classification=${material_color_classification}`
  const p5 = `&supplier_material_name_1=${supplier_material_name_1}&material_color_description_1=${material_color_description_1}`
  const p6 = `&supplier_material_name_2=${supplier_material_name_2}&material_color_description_2=${material_color_description_2}`
  const p7 = `&categories_materials=${categories_materials}&actual_total_purchased_kg_quantity=${actual_total_purchased_kg_quantity}`
  const p8 = `&notes_on_physical_control_plan=${notes_on_physical_control_plan}&abnormal_progress_report=${abnormal_progress_report}`
  const p9 = `&exceeded_planned_delivery_date_exception_description=${exceeded_planned_delivery_date_exception_description}&follow_up_major_quality_abnormalities=${follow_up_major_quality_abnormalities}`
  const p10 = `&material_classification_identification_code_1=${material_classification_identification_code_1}&material_classification_identification_code_2=${material_classification_identification_code_2}`
  const params = `${p1}${p2}${p3}${p4}${p5}${p6}${p7}${p8}${p9}${p10}`.split('undefined').join('')
  return request({ method: 'get', url: `/api/v1/material_total${params}` })
}
// 编辑采购总表
export const updateMaterial = (data) => {
  return request({ method: 'put', url: `/api/v1/material_total`, data })
}
// 下载采购总表
export const downloadMaterial = ({
  code,
  spu,
  status,
  start_date,
  end_date
}) => {
  return request({ method: 'get', url: `/api/v1/material_total_download?code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}`, responseType: 'blob', headers: {} })
}
// 查看采购分表
export const getMaterialSub = ({
  code,
  spu,
  status,
  start_date,
  end_date,
  page,
  size,
}) => {
  return request({ method: 'get', url: `/api/v1/material_sub?page=${page}&size=${size}&code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}` })
}
// 编辑采购分表
export const updateMaterialSub = (data) => {
  return request({ method: 'put', url: `/api/v1/material_sub`, data })
}
// 上传采购分表
export const uploadMaterialSub = (data) => {
  return request({ method: 'post', url: `/api/v1/material_sub_upload`, data, headers: {'content-type': 'application/x-www-form-urlencoded'}})
}
// 下载采购分表
export const downloadMaterialSub = ({
  code,
  spu,
  status,
  start_date,
  end_date
}) => {
  return request({ method: 'get', url: `/api/v1/material_sub_download?code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}`, responseType: 'blob', headers: {} })
}
// 查看裁剪中心接收日产能生产计划表
export const getProducePlan = ({
  code,
  spu,
  status,
  start_date,
  end_date,
  page,
  size,
  garment_color_description,
  production_plant,
  head_pc,
  cutting_bed_factory,
  is_it_over_damaged,
  final_evaluation_over_loss,
  abnormal_analysis_remarks,
  is_there_deduction_order_issued,
  has_label_been_arranged,
  has_information_been_returned,
  marking_month,
  super_damage_ladder,
  ladder_standard
}) => {
  const params1 = `?page=${page}&size=${size}&code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}`
  const params2 = `&garment_color_description=${garment_color_description}&production_plant=${production_plant}&head_pc=${head_pc}`
  const params3 = `&cutting_bed_factory=${cutting_bed_factory}&is_it_over_damaged=${is_it_over_damaged}&final_evaluation_over_loss=${final_evaluation_over_loss}`
  const params4 = `&abnormal_analysis_remarks=${abnormal_analysis_remarks}&is_there_deduction_order_issued=${is_there_deduction_order_issued}&has_label_been_arranged=${has_label_been_arranged}`
  const params5 = `&has_information_been_returned=${has_information_been_returned}&marking_month=${marking_month}&super_damage_ladder=${super_damage_ladder}&ladder_standard=${ladder_standard}`
  const url = `/api/v1/produce_plan${params1}${params2}${params3}${params4}${params5}`
  return request({ method: 'get', url: url })
}
// 编辑裁剪中心接收日产能生产计划表
export const updateProducePlan = (data) => {
  return request({ method: 'put', url: `/api/v1/produce_plan`, data })
}
// 上传裁剪中心接收日产能生产计划表
export const uploadProducePlan = (data) => {
  return request({ method: 'post', url: `/api/v1/produce_plan_upload`, data, headers: {'content-type': 'application/x-www-form-urlencoded'}})
}
// 下载裁剪中心接收日产能生产计划表
export const downloadProducePlan = ({
  code,
  spu,
  status,
  start_date,
  end_date,
  page,
  size,
  garment_color_description,
  production_plant,
  head_pc,
  cutting_bed_factory,
  is_it_over_damaged,
  final_evaluation_over_loss,
  abnormal_analysis_remarks,
  is_there_deduction_order_issued,
  has_label_been_arranged,
  has_information_been_returned,
  marking_month,
  super_damage_ladder,
  ladder_standard
}) => {
  const params1 = `?page=${page}&size=${size}&code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}`
  const params2 = `&garment_color_description=${garment_color_description}&production_plant=${production_plant}&head_pc=${head_pc}`
  const params3 = `&cutting_bed_factory=${cutting_bed_factory}&is_it_over_damaged=${is_it_over_damaged}&final_evaluation_over_loss=${final_evaluation_over_loss}`
  const params4 = `&abnormal_analysis_remarks=${abnormal_analysis_remarks}&is_there_deduction_order_issued=${is_there_deduction_order_issued}&has_label_been_arranged=${has_label_been_arranged}`
  const params5 = `&has_information_been_returned=${has_information_been_returned}&marking_month=${marking_month}&super_damage_ladder=${super_damage_ladder}&ladder_standard=${ladder_standard}`
  return request({ method: 'get', url: `/api/v1/produce_plan_download${params1}${params2}${params3}${params4}${params5}`, responseType: 'blob', headers: {} })
}
// 查看PC计划进度表
export const getPcProgress = ({
  code,
  spu,
  status,
  start_date,
  end_date,
  page,
  size,
  number_color_adjust_pc,
  identification_code,
  order_month,
  shop,
  garment_color_description,
  delivery_time_middle_platform_work_order,
  finished_product_requirements_warehouse_period,
  pc_ops_communication_update_warehouse_period,
  arrival_date_first_batch_goods,
  arrival_date_second_batch_goods,
  whether_discharge_factory,
  pre_planning_plant,
  production_plant,
  head_pc,
  order_control_date,
  material_trimming_plan_latest_dispatch_date,
  finishing_surface_accessories_date_issue,
  dispensing_status,
  fabric_plan_consolidation_period,
  actual_fabric_leveling_period,
  completion_shrinkage_date,
  fabric_actual_inbound_date,
  delivery_month,
  actual_arrival_date_first_batch_goods_warehouse,
  actual_arrival_date_second_batch_goods_warehouse,
  delivery_period_status,
  detailed_reasons_for_abnormal_delivery_dates,
  reporting_rate_greater,
  factory_delivery_status,
  first_shipment_physical_arrival_date,
  second_shipment_physical_arrival_date,
  factory_production_progress,
  whether_burst_ware,
  arrival_month
}) => {
  const p1 = `?page=${page}&size=${size}&code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}`
  const p2 = `&number_color_adjust_pc=${number_color_adjust_pc}&identification_code=${identification_code}&order_month=${order_month}&shop=${shop}`
  const p3 = `&garment_color_description=${garment_color_description}&delivery_time_middle_platform_work_order=${delivery_time_middle_platform_work_order}`
  const p4 = `&finished_product_requirements_warehouse_period=${finished_product_requirements_warehouse_period}&pc_ops_communication_update_warehouse_period=${pc_ops_communication_update_warehouse_period}`
  const p5 = `&arrival_date_first_batch_goods=${arrival_date_first_batch_goods}&arrival_date_second_batch_goods=${arrival_date_second_batch_goods}`
  const p6 = `&whether_discharge_factory=${whether_discharge_factory}&pre_planning_plant=${pre_planning_plant}&production_plant=${production_plant}&head_pc=${head_pc}`
  const p7 = `&order_control_date=${order_control_date}&material_trimming_plan_latest_dispatch_date=${material_trimming_plan_latest_dispatch_date}`
  const p8 = `&finishing_surface_accessories_date_issue=${finishing_surface_accessories_date_issue}&dispensing_status=${dispensing_status}`
  const p9 = `&fabric_plan_consolidation_period=${fabric_plan_consolidation_period}&actual_fabric_leveling_period=${actual_fabric_leveling_period}`
  const p10 = `&completion_shrinkage_date=${completion_shrinkage_date}&fabric_actual_inbound_date=${fabric_actual_inbound_date}&delivery_month=${delivery_month}`
  const p11 = `&actual_arrival_date_first_batch_goods_warehouse=${actual_arrival_date_first_batch_goods_warehouse}&actual_arrival_date_second_batch_goods_warehouse=${actual_arrival_date_second_batch_goods_warehouse}`
  const p12 = `&delivery_period_status=${delivery_period_status}&detailed_reasons_for_abnormal_delivery_dates=${detailed_reasons_for_abnormal_delivery_dates}`
  const p13 = `&reporting_rate_greater=${reporting_rate_greater}&factory_delivery_status=${factory_delivery_status}&first_shipment_physical_arrival_date=${first_shipment_physical_arrival_date}`
  const p14 = `&second_shipment_physical_arrival_date=${second_shipment_physical_arrival_date}&factory_production_progress=${factory_production_progress}`
  const p15 = `&whether_burst_ware=${whether_burst_ware}&arrival_month=${arrival_month}`
  const params = `${p1}${p2}${p3}${p4}${p5}${p6}${p7}${p8}${p9}${p10}${p11}${p12}${p13}${p14}${p15}`.split("undefined").join('')
  return request({ method: 'get', url: `/api/v1/pc_progress${params}` })
}
// PC数据拆分
export const purchasePcSplit = (data) => {
  return request({ method: 'post', url: `/api/v1/purchase_pc_split`, data })
}
// 编辑PC计划进度表
export const updatePcProgress = (data) => {
  return request({ method: 'put', url: `/api/v1/pc_progress`, data })
}
// 上传PC计划进度表
export const uploadPcProgress = (data) => {
  return request({ method: 'post', url: `/api/v1/pc_progress_upload`, data, headers: {'content-type': 'application/x-www-form-urlencoded'}})
}
// 下载PC计划进度表
export const downloadPcProgress = ({
  code,
  spu,
  status,
  start_date,
  end_date
}) => {
  return request({ method: 'get', url: `/api/v1/pc_progress_download?code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}`, responseType: 'blob', headers: {} })
}
// 查看每日回货进度表
export const getDailyReturnProgress = (order_id) => {
  return request({ method: 'get', url: `/api/v1/daily_return_progress?order_id=${order_id}` })
}
// 编辑每日回货进度表
export const updateDailyReturnProgress = (data) => {
  return request({ method: 'put', url: `/api/v1/daily_return_progress`, data })
}
// 上传每日回货进度表
export const uploadDailyReturnProgress = (data) => {
  return request({ method: 'post', url: `/api/v1/daily_return_progress_upload`, data, headers: {'content-type': 'application/x-www-form-urlencoded'}})
}
// 下载每日回货进度表
export const downloadDailyReturnProgress = (orderId) => {
  return request({ method: 'get', url: `/api/v1/daily_return_progress_download?order_id=${orderId}`, responseType: 'blob', headers: {} })
}
// 查看订单中的BOM表
export const getBomOrder = ({
  code,
  spu,
  status,
  start_date,
  end_date
}) => {
  return request({ method: 'get', url: `/api/v1/bom_order?code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}` })
}
// 下载订单中的BOM表
export const downloadBomOrder = ({
  code,
  spu,
  status,
  start_date,
  end_date
}) => {
  return request({ method: 'get', url: `/api/v1/bom_order_download?code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}`, responseType: 'blob', headers: {} })
}
// 查看订单中的物料和成衣周期表
export const getGarmentCycleOrder = ({ page, size, garment_color_description, spu }) => {
  return request({ method: 'get', url: `/api/v1/garment_cycle_template?page=${page}&size=${size}&garment_color_description=${garment_color_description}&spu=${spu}` })
}
// 下载订单中的物料和成衣周期表
export const downloadGarmentCycleOrder = (orderId) => {
  return request({ method: 'get', url: `/api/v1/garment_cycle_download?order_id=${orderId}`, responseType: 'blob', headers: {} })
}
// 查看BOM配置文件
export const getBomTemplate = (spu, page, size) => {
  return request({ method: 'get', url: `/api/v1/bom_template?spu=${spu}&page=${page}&size=${size}` })
}
// 编辑BOM配置文件
export const updateBomTemplate = (data) => {
  return request({ method: 'put', url: `/api/v1/bom_template`, data })
}
// 上传BOM配置文件
export const uploadBomTemplate = (data, headers) => {
  return request({ method: 'post', url: `/api/v1/bom_template`, data, headers })
}
// 上传物料和成衣周期配置文件
export const uploadGarmentCycleTemplate = (data) => {
  return request({ method: 'post', url: `/api/v1/garment_cycle_template`, data, headers: {'content-type': 'application/x-www-form-urlencoded'}})
}
// 工单汇总
export const downloaSummary = ({code, status, start_date, end_date, page, size, spu}) => {
  return request({ method: 'get', url: `/api/v1/purchase_data_summary_download?code=${code}&status=${status}&start_date=${start_date}&end_date=${end_date}&page=${page}&size=${size}&spu=${spu}`, responseType: 'blob', headers: {} })
}
// 采购工单完成
export const changeStatus = (data) => {
  return request({ method: 'put', url: `/api/v1/purchase_status_change`, data })
}
// 下物料采购计划时间/批次
export const getPurchasePlan = ({order_id, data_id}) => {
  return request({ method: 'get', url: `/api/v1/purchase_plan_button?order_id=${order_id}&data_id=${data_id}`})
}
// 查看发料单
export const getMaterialDeliverylist = ({
  code,
  spu,
  status,
  start_date,
  end_date,
  page,
  size,
}) => {
  return request({ method: 'get', url: `/api/v1/material_delivery_list?page=${page}&size=${size}&code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}` })
}
// 编辑发料单
export const updateMaterialDeliverylist = (data) => {
  return request({ method: 'put', url: `/api/v1/material_delivery_list`, data })
}
// 上传发料单
export const uploadMaterialDeliverylist = (data) => {
  return request({ method: 'post', url: `/api/v1/material_delivery_list_upload`, data, headers: {'content-type': 'application/x-www-form-urlencoded'}})
}
// 下载发料单
export const downloadMaterialDeliverylist = ({
  code,
  spu,
  status,
  start_date,
  end_date
}) => {
  return request({ method: 'get', url: `/api/v1/material_delivery_list_download??code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}`, responseType: 'blob', headers: {} })
}
// 发料单打印
export const materialDeliverylistPrint = ({
  code,
  spu,
  status,
  start_date,
  end_date
}) => {
  return request({ method: 'get', url: `/api/v1/material_delivery_list_print?code=${code}&spu=${spu}&status=${status}&start_date=${start_date}&end_date=${end_date}` })
}
// 采购下单按钮
export const getPurchaseOrderBtn = (order_id, data_id) => {
  return request({ method: 'get', url: `/api/v1/purchase_order_button?order_id=${order_id}&data_id=${data_id}` })
}
// 进销存
// 面料入库查询
export const getWarehouseFabricInbound = ({
  start_date,
  end_date,
  idc_2,
  supplier,
  category,
  size,
  currentPage,
  name,
  color,
  cylinder_number,
  work_order_num,
  sort,
  sort_seq
}) => {
  const paramsUrl = `start_date=${start_date}&end_date=${end_date}&idc2=${idc_2}&supplied=${supplier}&material_category=${category}&material_name=${name}&size=${size}&page=${currentPage}&color=${color}&cylinder_number=${cylinder_number}&work_order_num=${work_order_num}&sort=${sort}&sort_seq=${sort_seq}`
  return request({ method: 'get', url: `/api/v1/warehouse_fabric_inbound?${paramsUrl}` })
}
// 面料入库新增
export const addWarehouseFabricInbound = (data) => {
  return request({ method: 'post', url: `/api/v1/warehouse_fabric_inbound`, data })
}
// 面料入库编辑
export const updateWarehouseFabricInbound = (data) => {
  return request({ method: 'put', url: `/api/v1/warehouse_fabric_inbound`, data })
}
// 面料出库查询
export const getWarehouseFabricOutbound = ({
  start_date,
  end_date,
  idc_2,
  supplier,
  category,
  size,
  currentPage,
  name,
  color,
  cylinder_number,
  work_order_num,
  sort,
  sort_seq
}) => {
  const paramsUrl = `start_date=${start_date}&end_date=${end_date}&idc2=${idc_2}&supplied=${supplier}&material_category=${category}&material_name=${name}&size=${size}&page=${currentPage}&color=${color}&cylinder_number=${cylinder_number}&work_order_num=${work_order_num}&sort=${sort}&sort_seq=${sort_seq}`
  return request({ method: 'get', url: `/api/v1/warehouse_fabric_outbound?${paramsUrl}` })
}
// 面料出库新增
export const addWarehouseFabricOutbound = (data) => {
  return request({ method: 'post', url: `/api/v1/warehouse_fabric_outbound`, data })
}
// 面料出库编辑
export const updateWarehouseFabricOutbound = (data) => {
  return request({ method: 'put', url: `/api/v1/warehouse_fabric_outbound`, data })
}
// 面料库存查询
export const getWarehouseFabricInventory = ({
  idc_2,
  supplier,
  category,
  size,
  currentPage,
  name,
  color,
  work_order_num,
  inventory_kg,
  inventory_strip,
  sort,
  sort_seq
}) => {
  const paramsUrl = `idc2=${idc_2}&supplied=${supplier}&material_category=${category}&material_name=${name}&size=${size}&page=${currentPage}&color=${color}&work_order_num=${work_order_num}&inventory_kg=${inventory_kg}&inventory_strip=${inventory_strip}&sort=${sort}&sort_seq=${sort_seq}`
  return request({ method: 'get', url: `/api/v1/warehouse_fabric_inventory?${paramsUrl}` })
}
// 面料库存编辑
export const updateWarehouseFabricInventory = (data) => {
  return request({ method: 'put', url: `/api/v1/warehouse_fabric_inventory`, data })
}
// 面料供应商
export const getFabricSupplied = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_fabric_supplied` })
}
// 面料识别码2列表
export const getFabricIdc2 = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_fabric_idc2` })
}
// 面料物料品类列表
export const getFabricMaterialCategory = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_fabric_material_category` })
}
// 面料物料名称列表
export const getFabricMaterialName = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_fabric_material_name` })
}
// 辅料入库查询
export const getWarehouseAuxiliaryInbound = ({
  start_date,
  end_date,
  idc_2,
  supplier,
  category,
  size,
  currentPage,
  name,
  color,
  specification,
  work_order_num,
  sort,
  sort_seq
}) => {
  const paramsUrl = `start_date=${start_date}&end_date=${end_date}&idc2=${idc_2}&supplied=${supplier}&material_category=${category}&material_name=${name}&size=${size}&page=${currentPage}&color=${color}&specification=${specification}&work_order_num=${work_order_num}&sort=${sort}&sort_seq=${sort_seq}`
  return request({ method: 'get', url: `/api/v1/warehouse_auxiliary_inbound?${paramsUrl}` })
}
// 辅料入库编辑
export const updateWarehouseAuxiliaryInbound = (data) => {
  return request({ method: 'put', url: `/api/v1/warehouse_auxiliary_inbound`, data })
}
// 辅料入库新增
export const addWarehouseAuxiliaryInbound = (data) => {
  return request({ method: 'post', url: `/api/v1/warehouse_auxiliary_inbound`, data })
}
// 辅料出库查询
export const getWarehouseAuxiliaryOutbound = ({
  start_date,
  end_date,
  idc_2,
  supplier,
  category,
  size,
  currentPage,
  name,
  color,
  specification,
  work_order_num,
  sort,
  sort_seq
}) => {
  const paramsUrl = `start_date=${start_date}&end_date=${end_date}&idc2=${idc_2}&supplied=${supplier}&material_category=${category}&material_name=${name}&size=${size}&page=${currentPage}&color=${color}&specification=${specification}&work_order_num=${work_order_num}&sort=${sort}&sort_seq=${sort_seq}`
  return request({ method: 'get', url: `/api/v1/warehouse_auxiliary_outbound?${paramsUrl}` })
}
// 辅料出库编辑
export const updateWarehouseAuxiliaryOutbound = (data) => {
  return request({ method: 'put', url: `/api/v1/warehouse_auxiliary_outbound`, data })
}
// 辅料出库新增
export const addWarehouseAuxiliaryOutbound = (data) => {
  return request({ method: 'post', url: `/api/v1/warehouse_auxiliary_outbound`, data })
}
// 辅料库存查询
export const getWarehouseAuxiliaryInventory = ({
  idc_2,
  supplier,
  category,
  size,
  currentPage,
  name,
  color,
  work_order_num,
  specification,
  sort,
  sort_seq
}) => {
  const paramsUrl = `idc2=${idc_2}&supplied=${supplier}&material_category=${category}&material_name=${name}&size=${size}&page=${currentPage}&color=${color}&work_order_num=${work_order_num}&specification=${specification}&sort=${sort}&sort_seq=${sort_seq}`
  return request({ method: 'get', url: `/api/v1/warehouse_auxiliary_inventory?${paramsUrl}` })
}
// 辅料库存编辑
export const updateWarehouseAuxiliaryInventory = (data) => {
  return request({ method: 'put', url: `/api/v1/warehouse_auxiliary_inventory`, data })
}
// 辅料供应商
export const getAuxiliarySupplied = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_auxiliary_supplied` })
}
// 辅料物料品类列表
export const getAuxiliaryMaterialCategory = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_auxiliary_material_category` })
}
// 辅料物料名称列表
export const getAuxiliaryMaterialName = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_auxiliary_material_name` })
}
// 辅料识别码2列表
export const getAuxiliaryIdc2 = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_auxiliary_idc2` })
}
//面料入库删除
export const deleteFabricInbound = (data) => {
  return request({ method: 'delete', url: `/api/v1/warehouse_fabric_inbound`, data })
}
//面料出库删除
export const deleteFabricOutbound = (data) => {
  return request({ method: 'delete', url: `/api/v1/warehouse_fabric_outbound`, data })
}
//辅料入库删除
export const deleteAuxiliaryInbound = (data) => {
  return request({ method: 'delete', url: `/api/v1/warehouse_auxiliary_inbound`, data })
}
//辅料出库删除
export const deleteAuxiliaryOutbound = (data) => {
  return request({ method: 'delete', url: `/api/v1/warehouse_auxiliary_outbound`, data })
}
// 面料工单号
export const getFabricWorkOrderNum = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_fabric_work_order_num` })
}
// 辅料工单号
export const getAuxiliaryWorkOrderNum = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_auxiliary_work_order_num` })
}
// 面料颜色
export const getFabricColor = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_fabric_color` })
}
// 辅料颜色
export const getAuxiliaryColor = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_auxiliary_color` })
}
// 面料缸号
export const getFabricCylinderNumber = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_fabric_cylinder_number` })
}
// 辅料规格
export const getAuxiliarySpecification = () => {
  return request({ method: 'get', url: `/api/v1/warehouse_auxiliary_specification` })
}
// 面料入库文件导出
export const downloadFabricInbound = ({
  start_date,
  end_date,
  idc_2,
  supplier,
  category,
  name,
  color,
  cylinder_number,
  work_order_num,
  sort,
  sort_seq
}) => {
  const paramsUrl = `start_date=${start_date}&end_date=${end_date}&idc2=${idc_2}&supplied=${supplier}&material_category=${category}&material_name=${name}&color=${color}&cylinder_number=${cylinder_number}&work_order_num=${work_order_num}&sort=${sort}&sort_seq=${sort_seq}`
  return request({ method: 'get', url: `/api/v1/warehouse_fabric_inbound_download?${paramsUrl}`, responseType: 'blob', headers: {} })
}
// 面料出库文件导出
export const downloadFabricOutbound = ({
  start_date,
  end_date,
  idc_2,
  supplier,
  category,
  name,
  color,
  cylinder_number,
  work_order_num,
  sort,
  sort_seq
}) => {
  const paramsUrl = `start_date=${start_date}&end_date=${end_date}&idc2=${idc_2}&supplied=${supplier}&material_category=${category}&material_name=${name}&color=${color}&cylinder_number=${cylinder_number}&work_order_num=${work_order_num}&sort=${sort}&sort_seq=${sort_seq}`
  return request({ method: 'get', url: `/api/v1/warehouse_fabric_outbound_download?${paramsUrl}`, responseType: 'blob', headers: {} })
}
// 面料库存文件导出
export const downloadFabricInventory = ({
  idc_2,
  supplier,
  category,
  name,
  color,
  inventory_kg,
  inventory_strip,
  work_order_num,
  sort,
  sort_seq
}) => {
  const paramsUrl = `idc2=${idc_2}&supplied=${supplier}&material_category=${category}&material_name=${name}&color=${color}&inventory_kg=${inventory_kg}&inventory_strip=${inventory_strip}&work_order_num=${work_order_num}&sort=${sort}&sort_seq=${sort_seq}`
  return request({ method: 'get', url: `/api/v1/warehouse_fabric_inventory_download?${paramsUrl}`, responseType: 'blob', headers: {} })
}
// 辅料入库文件导出
export const downloadAuxiliaryInbound = ({
  start_date,
  end_date,
  idc_2,
  supplier,
  category,
  name,
  color,
  specification,
  work_order_num,
  sort,
  sort_seq
}) => {
  const paramsUrl = `start_date=${start_date}&end_date=${end_date}&idc2=${idc_2}&supplied=${supplier}&material_category=${category}&material_name=${name}&color=${color}&specification=${specification}&work_order_num=${work_order_num}&sort=${sort}&sort_seq=${sort_seq}`
  return request({ method: 'get', url: `/api/v1/warehouse_auxiliary_inbound_download?${paramsUrl}`, responseType: 'blob', headers: {} })
}
// 辅料出库文件导出
export const downloadAuxiliaryOutbound = ({
  start_date,
  end_date,
  idc_2,
  supplier,
  category,
  name,
  color,
  specification,
  work_order_num,
  sort,
  sort_seq
}) => {
  const paramsUrl = `start_date=${start_date}&end_date=${end_date}&idc2=${idc_2}&supplied=${supplier}&material_category=${category}&material_name=${name}&color=${color}&specification=${specification}&work_order_num=${work_order_num}&sort=${sort}&sort_seq=${sort_seq}`
  return request({ method: 'get', url: `/api/v1/warehouse_auxiliary_outbound_download?${paramsUrl}`, responseType: 'blob', headers: {} })
}
// 辅料库存文件导出
export const downloadAuxiliaryInventory = ({
  idc_2,
  supplier,
  category,
  name,
  color,
  specification,
  work_order_num,
  sort,
  sort_seq
}) => {
  const paramsUrl = `idc2=${idc_2}&supplied=${supplier}&material_category=${category}&material_name=${name}&color=${color}&specification=${specification}&work_order_num=${work_order_num}&sort=${sort}&sort_seq=${sort_seq}`
  return request({ method: 'get', url: `/api/v1/warehouse_auxiliary_inventory_download?${paramsUrl}`, responseType: 'blob', headers: {} })
}
// 面料入库记录导入
export const uploadFabricInbound = (data) => {
  return request({ method: 'post', url: `/api/v1/warehouse_fabric_inbound_upload`, data, headers: {'content-type': 'application/x-www-form-urlencoded'}})
}
// 面料出库记录导入
export const uploadFabricOutbound = (data) => {
  return request({ method: 'post', url: `/api/v1/warehouse_fabric_outbound_upload`, data, headers: {'content-type': 'application/x-www-form-urlencoded'}})
}
// 辅料入库记录导入
export const uploadAuxiliaryInbound = (data) => {
  return request({ method: 'post', url: `/api/v1/warehouse_auxiliary_inbound_upload`, data, headers: {'content-type': 'application/x-www-form-urlencoded'}})
}
// 辅料出库记录导入
export const uploadAuxiliaryOutbound = (data) => {
  return request({ method: 'post', url: `/api/v1/warehouse_auxiliary_outbound_upload`, data, headers: {'content-type': 'application/x-www-form-urlencoded'}})
}
// 商品列表查询
export const getTransparentGoodsList = ({
  start_date,
  end_date,
  asin,
  msku,
  brand,
  status,
  page,
  size,
  need_opr
}) => {
  const paramsUrl = `start_date=${start_date}&end_date=${end_date}&asin=${asin}&msku=${msku}&brand=${brand}&status=${status}&page=${page}&size=${size}&need_opr=${need_opr}`
  return request({ method: 'get', url: `/api/v1/transparent_goods_list?${paramsUrl}` })
}
// FBA货件查询
export const getTransparentFbaShipments = ({
  asin,
  shipment_id,
  enroll,
  shipment_status,
  difference_in_application,
  differences_in_sending_and_receiving,
  differences_in_application_and_collection,
  page,
  size,
  shipment_finish
}) => {
  const paramsUrl = `asin=${asin}&enroll=${enroll}&shipment_id=${shipment_id}&shipment_status=${shipment_status}&difference_in_application=${difference_in_application}&differences_in_sending_and_receiving=${differences_in_sending_and_receiving}&page=${page}&size=${size}&differences_in_application_and_collection=${differences_in_application_and_collection}&shipment_finish=${shipment_finish}`
  return request({ method: 'get', url: `/api/v1/transparent_fba_shipments?${paramsUrl}` })
}
// 发货计划查询
export const getTransparentDeliverySchedule = ({
  asin,
  start_date,
  end_date,
  schedule_id,
  transparent_tag_print_tag,
  msku,
  page,
  size,
}) => {
  const paramsUrl = `asin=${asin}&start_date=${start_date}&end_date=${end_date}&schedule_id=${schedule_id}&transparent_tag_print_tag=${transparent_tag_print_tag}&msku=${msku}&page=${page}&size=${size}`
  return request({ method: 'get', url: `/api/v1/transparent_delivery_schedule?${paramsUrl}` })
}
// 发货计划忽略/不忽略操作
export const ignoreFbaPlan = (data) => {
  return request({ method: 'put', url: `/api/v1/ignore_fba_plan`, data })
}
// FBA货件忽略/不忽略操作
export const ignoreFbaShipment = (data) => {
  return request({ method: 'put', url: `/api/v1/ignore_fba_shipment`, data })
}
// 查看各款参考用量及捆条用量配置文件
export const getSpuBundleUsage = ({
  spu,
  page,
  size,
}) => {
  const paramsUrl = `spu=${spu}&page=${page}&size=${size}`
  return request({ method: 'get', url: `/api/v1/spu_bundle_usage?${paramsUrl}` })
}
// 上传各款参考用量及捆条用量配置文件
export const uploadSpuBundleUsage = (data) => {
  return request({ method: 'post', url: `/api/v1/spu_bundle_usage`, data, headers: {'content-type': 'application/x-www-form-urlencoded'}})
}
// T-Code数量申请
export const getApplyTcode = (data) => {
  return request({ method: 'post', url: `/api/v1/transparent_apply_tcode`, data })
}